package com.ferry.wallpaper.service.impl;

import com.ferry.wallpaper.mapper.WallTypeMapper;
import com.ferry.wallpaper.domain.WallType;
import com.ferry.wallpaper.service.WallTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class WallTypeServiceImpl implements WallTypeService {

    @Autowired
    private WallTypeMapper wallTypeMapper;

    @Override
    public List<WallType> getAll() {
        return wallTypeMapper.selectList(null);
    }

    @Override
    public boolean add(String name) {
        WallType wallType = new WallType();
        wallType.setWallTypeName(name);
        int insert = wallTypeMapper.insert(wallType);
        return insert>0;
    }

    @Override
    public boolean delete(Long id) {
        return wallTypeMapper.deleteById(id) > 0;
    }
}
